package com.photographysharing.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.photographysharing.common.ThreadLocalOperation;
import com.photographysharing.dto.UserWatchPhotoDTO;
import com.photographysharing.entity.UserWatchPhotos;
import com.photographysharing.response.DatasResponse;
import com.photographysharing.service.UserWatchPhotosService;
import com.photographysharing.mapper.UserWatchPhotosMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Z
* @description 针对表【user_watch_photos】的数据库操作Service实现
* @createDate 2024-05-14 21:15:12
*/
@Service
public class UserWatchPhotosServiceImpl extends ServiceImpl<UserWatchPhotosMapper, UserWatchPhotos>
    implements UserWatchPhotosService{
    private UserWatchPhotosMapper mapper;

    public UserWatchPhotosServiceImpl(UserWatchPhotosMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public DatasResponse<UserWatchPhotoDTO> selectByMyself() {
        String userId = ThreadLocalOperation.getThreadLocalUserId();
        List<UserWatchPhotoDTO> datas = mapper.selectByMyself(userId);
        return new DatasResponse<>(datas.size(),datas);
    }
}




